From: Carlhuda Date: Thu, 20 Mar 2014 01:25:14 +0000 (-0700) Subject: Integration tests working X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~1129^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=3b350463afaa3aae3728b3f42b4c84b4566650a4;p=cargo.git Integration tests working Next up: cleanup --- diff --git a/Makefile b/Makefile index 99b7559f8..ddbf0d1f8 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ $(HAMMER): $(wildcard libs/hammer.rs/src/*.rs) $(TOML): $(wildcard libs/rust-toml/src/toml/*.rs) cd libs/rust-toml && make -$(HAMCREST): $(wildcard libs/hamcrest-rust/src/*.rs) +$(HAMCREST): $(wildcard libs/hamcrest-rust/src/hamcrest/*.rs) cd libs/hamcrest-rust && make # === Cargo diff --git a/libs/hamcrest-rust b/libs/hamcrest-rust index 95f531ad8..39f006244 160000 --- a/libs/hamcrest-rust +++ b/libs/hamcrest-rust @@ -1 +1 @@ -Subproject commit 95f531ad8c726a832f28d171bde2860c77ec7619 +Subproject commit 39f00624492fd648631041eadf1301a08cd2a482 diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 48690aa3b..d4a1aab01 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1,7 +1,31 @@ use std; use support::project; +use hamcrest::{SelfDescribing,Description,Matcher,assert_that}; use cargo; +#[deriving(Clone,Eq)] +pub struct ExistingFile; + +impl SelfDescribing for ExistingFile { + fn describe_to(&self, desc: &mut Description) { + desc.append_text("an existing file"); + } +} + +impl Matcher for ExistingFile { + fn matches(&self, actual: &Path) -> bool { + actual.exists() + } + + fn describe_mismatch(&self, actual: &Path, desc: &mut Description) { + desc.append_text(format!("`{}` was missing", actual.display())); + } +} + +pub fn existing_file() -> ExistingFile { + ExistingFile +} + fn setup() { } @@ -39,6 +63,7 @@ test!(cargo_compile_with_explicit_manifest_path { Err(e) => println!("err: {}", e) } + assert_that(p.root().join("target/foo/bar"), existing_file()); assert!(p.root().join("target/foo").exists(), "the executable exists"); let o = cargo::util::process("foo") diff --git a/tests/tests.rs b/tests/tests.rs index 9e51bc559..3c74087d7 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -2,6 +2,7 @@ #[allow(deprecated_owned_vector)]; extern crate cargo; +extern crate hamcrest; macro_rules! test( ($name:ident $expr:expr) => (